SaveFileDialog
FileName$ = SaveFileDialog(Title$, DefaultFile$, Filter$, [FilterIndex])
 
Parameters:

    Title$=the dialog's title
    DefaultFile$=the initial file name
    Filter$=the filter string
    [FilterIndex]=the initially selected filter
Returns:

    FileName$=the file selected by the user
 

     SaveFileDialog shows a standard "SaveFile" dialog.
The function returns the filename the user has selected.

     * Title$ = the text displayed in the title bar of the dialog
     * DefaultFile$ = The default file displayed in the dialog. If you specify a full path it will also open the corresponding folder in the dialog.
     * Filter$ = the filter string (see below for more details).
     * FilterIndex = the filter that is initially active starting from 1 to the number of filters defined. This is an optional parameter and defaults to 1


The Filter$ string allows you to limit the file types that are displayed in the dialog. A filter string looks like this "Text files (*.txt)|*.TXT". The part before the "|" character describes the filter. This part is also shown in the dialog. The part after "|" is the actual filter. In this case only files with the extension "TXT" are shown. You can combine multiple filters for one description by seperating them with a semicolon (;). For example a filter that displays files with the extension "jpg" and "jpeg" would look like this "JPEG Images|*.jpg;*.jpeg". Lastly you can combine multiple description/filter pairs with a "|" character. In order to load text files or jpeg files a filter use this filter: "Text files|*.TXT|JPEG Images|*.jpg;*.jpeg".



FACTS:


      * The dialog is not asynchronous, so the PlayBasic application will halt while the dialog is open.
      * The dialog function returns a NULL string if no file was selected or the user selects cancel.


  
; Inlcude the Dialogs library in this program
  #Include "PBDialogs2"
  
  
; Title Of the Dialog
  Title$="Save A Text File"
  
; Pre-seed the file name we're expecting to find
  Filename$="Some Cool FIle.txt"
  
  
;   Filter$="" ; No Filter show all files
  Filter$     ="(*.TXT)|*.TXT"          ; Only TXT files
;     Filter$     ="(*.PNG)|*.PNG"          ; Only PNG files
;     Filter$     ="(*.BMP)|*.BMP"          ; Only BMP Files
;     Filter$     ="(*.Jpeg)|*.JPG"          ; Only JPG files
;     Filter$ ="(*.Images)|*.JPG;*.bmp;*.PNG;*gif"   ; Mixture of image files
  
  
; Call the Save Dialog
  File$=SaveFileDialog(Title$,Filename$,Filter$)
  
  
; Display the Info about this file$
  If FIle$=""
     Print "You Selected To: Cancel Save"
     
  Else
     
     If FileExist(file$)
        Print "You Selected To: Save Over Existing File"
     Else
        Print "You Selected To: Save A New File"
     EndIf
     
  EndIf
  
  // Display the screen & wait for a key press to end
  Sync
  WaitKey
  





 
Related Info: FolderDialog | GetFileDialogFilterIndex | OpenFileDialog :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com